import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/application/smart_warehouse/in_out_record_entity.dart';

InOutRecordEntity $InOutRecordEntityFromJson(Map<String, dynamic> json) {
  final InOutRecordEntity inOutRecordEntity = InOutRecordEntity();
  final String? createDate = jsonConvert.convert<String>(json['createDate']);
  if (createDate != null) {
    inOutRecordEntity.createDate = createDate;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    inOutRecordEntity.id = id;
  }
  final String? productId = jsonConvert.convert<String>(json['productId']);
  if (productId != null) {
    inOutRecordEntity.productId = productId;
  }
  final String? productName = jsonConvert.convert<String>(json['productName']);
  if (productName != null) {
    inOutRecordEntity.productName = productName;
  }
  final int? recordNum = jsonConvert.convert<int>(json['recordNum']);
  if (recordNum != null) {
    inOutRecordEntity.recordNum = recordNum;
  }
  final String? recordNumber = jsonConvert.convert<String>(json['recordNumber']);
  if (recordNumber != null) {
    inOutRecordEntity.recordNumber = recordNumber;
  }
  final int? recordType = jsonConvert.convert<int>(json['recordType']);
  if (recordType != null) {
    inOutRecordEntity.recordType = recordType;
  }
  final String? warehouseEntryAndExitPersonnelId = jsonConvert.convert<String>(json['warehouseEntryAndExitPersonnelId']);
  if (warehouseEntryAndExitPersonnelId != null) {
    inOutRecordEntity.warehouseEntryAndExitPersonnelId = warehouseEntryAndExitPersonnelId;
  }
  final String? warehouseEntryAndExitPersonnelName = jsonConvert.convert<String>(json['warehouseEntryAndExitPersonnelName']);
  if (warehouseEntryAndExitPersonnelName != null) {
    inOutRecordEntity.warehouseEntryAndExitPersonnelName = warehouseEntryAndExitPersonnelName;
  }
  final String? warehouseId = jsonConvert.convert<String>(json['warehouseId']);
  if (warehouseId != null) {
    inOutRecordEntity.warehouseId = warehouseId;
  }
  final String? warehouseName = jsonConvert.convert<String>(json['warehouseName']);
  if (warehouseName != null) {
    inOutRecordEntity.warehouseName = warehouseName;
  }
  return inOutRecordEntity;
}

Map<String, dynamic> $InOutRecordEntityToJson(InOutRecordEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createDate'] = entity.createDate;
  data['id'] = entity.id;
  data['productId'] = entity.productId;
  data['productName'] = entity.productName;
  data['recordNum'] = entity.recordNum;
  data['recordNumber'] = entity.recordNumber;
  data['recordType'] = entity.recordType;
  data['warehouseEntryAndExitPersonnelId'] = entity.warehouseEntryAndExitPersonnelId;
  data['warehouseEntryAndExitPersonnelName'] = entity.warehouseEntryAndExitPersonnelName;
  data['warehouseId'] = entity.warehouseId;
  data['warehouseName'] = entity.warehouseName;
  return data;
}

extension InOutRecordEntityExtension on InOutRecordEntity {
  InOutRecordEntity copyWith({
    String? createDate,
    String? id,
    String? productId,
    String? productName,
    int? recordNum,
    String? recordNumber,
    int? recordType,
    String? warehouseEntryAndExitPersonnelId,
    String? warehouseEntryAndExitPersonnelName,
    String? warehouseId,
    String? warehouseName,
  }) {
    return InOutRecordEntity()
      ..createDate = createDate ?? this.createDate
      ..id = id ?? this.id
      ..productId = productId ?? this.productId
      ..productName = productName ?? this.productName
      ..recordNum = recordNum ?? this.recordNum
      ..recordNumber = recordNumber ?? this.recordNumber
      ..recordType = recordType ?? this.recordType
      ..warehouseEntryAndExitPersonnelId = warehouseEntryAndExitPersonnelId ?? this.warehouseEntryAndExitPersonnelId
      ..warehouseEntryAndExitPersonnelName = warehouseEntryAndExitPersonnelName ?? this.warehouseEntryAndExitPersonnelName
      ..warehouseId = warehouseId ?? this.warehouseId
      ..warehouseName = warehouseName ?? this.warehouseName;
  }
}
